<% content_for :main_classes do %>no-footer<% end %>

<%= javascript_include_tag 'task' %>
<%= include_plugins(@stack) %>
<%= render partial: 'shipit/stacks/header', locals: { stack: @stack } %>

<div class="sidebar">
  <div class="sidebar-plugins"></div>
</div>

<div class="deploy-main" data-task="<%= {repo: @stack.github_repo_name, description: task.title}.to_json %>">
  <span class="deploy-tasks"></span>
  <div class="deploy-banner" data-status="<%= task.status %>">
    <div class="deploy-banner-status"></div>
    <div class="deploy-banner-section stack-link">
      <%= link_to "Return to #{@stack.repo_name}/#{@stack.environment}", stack_path(@stack) %>
    </div>
    <div class="deploy-banner-section">
      <a href="#" class="user main-user disabled"><%= task.author.name %></a>
      <span class="deploy-status">
        <%= content_for :task_title %>
      </span>
      <%= link_to('(view raw output)', { format: :txt }) %>
    </div>

    <div class="deploy-banner-section action-buttons">
      <%= link_to abort_stack_task_path(@stack, task), class: "btn btn--alert action-button", data: { action: "abort", status: task.status } do %>
        <span class="caption--ready">Abort</span>
        <span class="caption--pending">Aborting...</span>
      <% end %>

      <% if task.supports_rollback? %>
        <%= link_to abort_stack_task_path(@stack, task, rollback: true), class: "btn btn--delete action-button", data: { action: "abort", rollback: true, status: task.status } do %>
          <span class="caption--ready">Abort and Rollback to <span class="short-sha-no-bg"><%= short_commit_sha(task) %></span></span>
          <span class="caption--pending">Aborting with Rollback... to <span class="short-sha-no-bg"><%= short_commit_sha(task) %></span></span>
        <% end %>
      <% end %>
    </div>
  </div>

  <div class="search-bar hidden">
    <input type="search" class="search-input" />
  </div>

  <div class="clusterize-scroll task-output-container task-output-container-main-page">
    <pre class="nowrap" data-status="<%= task.status %>"><code class="clusterize-content" data-output="<%= task.chunk_output %>" data-next-chunks-url="<%= next_chunks_url(task, last_byte: task.chunk_output_size) %>"></code></pre>
  </div>
</div>
